<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class CustomService extends BaseModel
{
    /**
     *  客户服务创建者
     */
    public function user(){
        return $this->belongsTo(User::class);
    }

    /**
     *  客户服务分配的负责用户
     */
    public function assignUser(){
        return $this->belongsTo(User::class,'assign_user_id');
    }

    /**
     *  上一次分配的负责用户
     */
    public function lastAssignUser(){
        return $this->belongsTo(User::class,'last_asssign_user_id');
    }

    /**
     *  服务类型
     */
    public function type(){
        return $this->belongsTo(BaseData::class,'service_type');
    }

    public function getStatusText(){
        if($this->status == 0){
            return '新建';
        }else if($this->status == 1){
            return '待处理';
        }elseif($this->status == 2){
            return '已处理';
        }elseif($this->status == 3){
            return '已归档';
        }
        return '未知';
    }
}
